<template>
    <div class="container">
        <div id="siderbar">
            <ul>
                <li>
                    <router-link to="/admin/userIndex">用户信息</router-link>
                </li>
                <li>
                    <router-link to="/admin/adminPosts">全部博客</router-link>
                </li>
                <li>
                    <router-link to="/admin/adminRemarks">全部评论</router-link>
                </li>
                <li>
                    <a @click="logout">退出登录</a>
                </li>
            </ul>
        </div>
        <div class="main-body">
            <router-view></router-view>
        </div>
    </div>
</template>
<script>
import axios from "axios";

 export default {
    methods: {
        logout() {
            axios.post('/api/logout')
            .then(response => {
                localStorage.removeItem('user');
                console.log(sessionStorage.getItem("user"));
                this.$router.push('/login');
            })
            .catch(error => {
                    console.log(error);
                });
            }
            }
            }


</script>
<style>
.container {
  display: flex;
  height: 100%;
}
#siderbar {
  width: 250px;
  height: 100%;
  background:#000000;
}

#siderbar li a {
  display: block;
  height: 69.7px;
  line-height: 69.7px;
  margin-bottom:113.96px;
  text-decoration:none;
  color:#fff;
}
#siderbar li a:hover{
  cursor: pointer;
  background: linear-gradient(90deg,#72fe53,#000000,#72fe53);
}
#siderbar li a.router-link-active {
  background: linear-gradient(90deg,#72fe53,#000000,#72fe53);
}

.main-body {
  flex: 1;
  height: 100%;
  background:-webkit-linear-gradient(#000000,#72fe53,#000000);
}
</style>
